export default{
    formatData:function(date,format){
        console.log("格式化日期");

        return "";
    },getDeviceCode:function(){//生成本设备的随机码
        var deviceCode = "";
        if (window.plus) {
            deviceCode = plus.device.uuid ;//plus.storage.getItem("deviceCode");
        }else{
            deviceCode = window.localStorage.getItem("deviceCode");
        }
        if(deviceCode == null || deviceCode == "" || deviceCode == undefined || deviceCode == "undefined"){
            deviceCode = "";
            var n = 64;
            var chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
            var res = "";
            for(var i = 0; i < n ; i ++) {
                var id = Math.ceil(Math.random()*35);
                res += chars[id];
            }
            deviceCode = res;
            window.localStorage.setItem("deviceCode",deviceCode);
            if (window.plus) plus.storage.setItem("deviceCode",deviceCode);
        }
        return deviceCode;
    },getDeviceId:function(){//生成本设备的随机码
        var deviceCode = "";
        if (window.plus) {
            deviceCode = plus.getDeviceId() ;//plus.storage.getItem("deviceCode");
        }else{
            deviceCode = window.localStorage.getItem("deviceCode");
        }
        if(deviceCode == null || deviceCode == "" || deviceCode == undefined || deviceCode == "undefined"){
            deviceCode = "";
            var n = 64;
            var chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
            var res = "";
            for(var i = 0; i < n ; i ++) {
                var id = Math.ceil(Math.random()*35);
                res += chars[id];
            }
            deviceCode = res;
            window.localStorage.setItem("deviceCode",deviceCode);
        }
        return deviceCode;
    }
}